<template>
	<el-dialog title="" visible :show-close="false" :modal-append-to-body="false" class="wrap"  >
		 <div class="bt">详情</div>
		<i class="el-icon-close close" @click="cancel" style="color: white;"></i>
		<el-form label-width="100px" class="form" >
			<el-form-item label="班级名称" class="select-block"  >
				  <el-input v-model="form.mc" :readonly='edit' icon="info" ></el-input>
			</el-form-item>
			<el-form-item label="老师名称" class="select-block" >
				  <el-input v-model="form.lsmc" :readonly='edit' icon="info" ></el-input>
			</el-form-item>
			<el-form-item label="行政老师" class="select-block" >
				  <el-input v-model="form.xzmc" :readonly='edit' icon="info" ></el-input>
			</el-form-item>
			<el-form-item label="预计开班时间" class="select-block">
				  <el-input v-model="form.yjkbrq" :readonly='edit' icon="info" ></el-input>
			</el-form-item>
			<el-form-item label="学生人数" class="select-block">
				  <el-input v-model="form.xs" :readonly='edit' icon="info" ></el-input>
			</el-form-item>
			<el-form-item label="课程名称" class="select-block">
				  <el-input v-model="form.fxkcmc" :readonly='edit' icon="info" ></el-input>
			</el-form-item>
			<el-form-item label="开班日期" class="select-block" style="width: 100%;"> 
				  <el-input v-model="form.yjkbrq" :readonly='edit' icon="info" ></el-input>
			</el-form-item>
		</el-form>
		<el-button type="primary" class="submit" @click="cancel">确定</el-button>
		<!--<el-button type="success" class="submit" @click="cancel1">编辑</el-button>-->
		<!--<el-button type="danger" class="submit" @click="cancel">开班</el-button>-->
	 <EditComponent v-if="portComponents.edit.toggle" @close="componentsHide" :params="portComponents.edit.params"></EditComponent>
		
	</el-dialog>

</template>

<script type="text/javascript">
	import qs from 'qs'
	import EditComponent from './edit'
	export default {
		 components: { EditComponent},
		props: ['params'],
		data() {
			return {
				form: {
					mc :'',
					lsmc :'',
					gh :'',
					dqdymc :'',
					cmc :'',
					jcmc :'',
					xxmc :'',
					isqy :'',
					lx :'',
					sj :'',
					zjmc :'',
					xs :'',
					ypks :'',
					fxkcmc :'',
					syks :'',
					kbrq :'',
					id: ''
				},
				edit:true,
				 portComponents: {
				 	 edit: {
                        type: 'edit',
                        toggle: false,
                        params: '',
                        data: {}
                    }
				 }
			}
		},
		created() {
     	this.form.id=this.params.row.id;
			this.loadinfo();
			this.cancel1();
		},
		methods: {
			edit1(){
				this.edit=false
			},
			loadinfo(){
				var logininfo = JSON.parse(localStorage.logininfo);
             var params2 = qs.stringify({
                 xxid:logininfo.xxid,
				 yhid:logininfo.id,
				 id:this.form.id
               })
             //执行
                 this.axios.post(this.$store.state.api + 'ysbj/info',  params2 )
                 .then(res => {
                 this.form=res.data.data
                 }).catch(res => {
					this.$message.warning("服务器异常");
 			 				this.$emit('close', { type: 'info', cancel: true });
				})
				
				
				
//				 var logininfo = JSON.parse(localStorage.logininfo) ;
//				 this.axios.get(this.$store.state.api+'ysbj/info',{
//						 params:{
//							 xxid:logininfo.xxid,
//							 yhid:logininfo.id,
//							 id:this.form.id
//						 }
//					}).then( res =>  {
//							this.form=res.data.data
//					 }).catch(res => {
//						 this.$message.warning("服务器异常");
//			 				this.$emit('close', { type: 'info', cancel: true });
//					 })
			},
			cancel() {
				this.$emit('close', { type: 'info', cancel: true })
			},
			cancel1() {
				this.show(EditComponent);
			}
		}
	}
</script>

<style lang="less" scoped>
	.wrap {
		color: white;
		text-align: center;
	}
	.bt{
		position: absolute;
		width: 100%;
		height: 50px;
		margin: 0 auto;
		top: 0;
		left: 0;
		background: #50BFFF;
		margin-bottom: 20px;
		color:white;
		text-align:left;
		line-height: 50px;
		font-size: 17px;
		padding-left: 15px;
	}
	.close{
			z-index: 10;
			position: absolute;
	}
	.form {
		text-align: left;
	margin-top: 20px;
	}
	 .input {
            width: 300px;
            display: inline-block;
        }

	.select-block {
		width: 45%;
		float: left;
		// display: block;
	}
	.submit {
		width: 120px;
		margin-top: 20px;
	}
</style>
